package com.wbs.controller;

import com.wbs.resutil.Result;
import com.wbs.resutil.ResultEnums;
import com.wbs.service.SeckillGoodsService;
import com.wbs.vo.SeckillGoodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 芝梦
 * @Description: 秒杀服务控制层
 * @DateTime: 2024/3/5 16:39
 */
@RequestMapping("SeckillGoods")
@RestController
public class SeckillGoodsController {
    @Autowired
    private SeckillGoodsService seckillGoodsService;

    //缓存预热
    @GetMapping("getRedisHot")
    public Result getRedisHot(){
        seckillGoodsService.getRedisHot();
        return Result.RESPONSE(ResultEnums.HOT_SUCCESS);
    }

    //获取redis中的数据
    @GetMapping("findSeckillGoodsList")
    public Result findSeckillGoodsList(){
        List<SeckillGoodsVO> seckillGoodsVOS = seckillGoodsService.findSeckillGoodsList();
        return Result.SUCCESS().setData(seckillGoodsVOS);
    }
}
